/**
 * 
 */
package other;

import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Row;
import org.junit.Test;

import com.zhiteng.entity.Bill;
import com.zhiteng.utils.common.DateUtil;
import com.zhiteng.utils.common.PoiUtils;

/**  
* <p>Title: Teset.java</p>  
* <p>Description: </p>  
* @author dragon  
* @date 2018年12月19日  
* @version 1.0  
*/
public class Teset {
	@Test
	public void fun1() throws ParseException {
		List<Bill> blist = new ArrayList<>();
		Bill b1 = new Bill();
		b1.setCreateDate((DateUtil.String2Date("2018-12-05 00:00")));
		Bill b2 = new Bill();
		b2.setCreateDate(DateUtil.String2Date("2018-12-04 00:00"));
		Bill b3 = new Bill();
		b3.setCreateDate(DateUtil.String2Date("2018-12-06 00:00"));
		blist.add(b1);
		blist.add(b2);
		blist.add(b3);
		Collections.sort(blist);;
		System.out.println(blist);
	}
	
	@Test
	public void fun2() throws ParseException {
		System.out.println(DateUtil.getWeek(DateUtil.Date2String(new Date())));
		/*//List<Integer> c = new ArrayList<>();	//2959
		List<Integer> c = new LinkedList<>();	//7814
		//Set c = new HashSet<>();	//5160
		long s = System.currentTimeMillis();
		for(int i=0;i<100000;i++) {
			c.add(0,i);
		}
		long e = System.currentTimeMillis();
		System.out.println(e-s);	*/
	}
	
	@Test
	public void fun3() {
//		System.out.println(".gif".matches(".JPEG|.jpeg|.JPG|.jpg|.PNG|.png|.GIF|.gif"));
//		System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));
		Long timestamp = System.currentTimeMillis();
		System.out.println(timestamp);
		System.out.println(DigestUtils.md5Hex(timestamp.toString()+"13a27ab62b6c47e7b363a91721818b8c").toUpperCase());
	}
	
	@Test
	public void fun4() throws ParseException {
		System.out.println(DateUtil.Date2String(new Date()));
	}
	
	@Test
	public void fun5() throws ParseException {
		Date d = new Date(1546593397000l);
		System.out.println(d);
	}
	
	@Test
	public void fun6() throws IOException {
		InputStream is = this.getClass().getClassLoader().getResourceAsStream("1.xls");
		POIFSFileSystem fs = new POIFSFileSystem(is);
		HSSFWorkbook wb=new HSSFWorkbook(fs);
		HSSFSheet hssfSheet=wb.getSheetAt(0);  	//	获取第一个Sheet页
		//System.out.println(hssfSheet);
		String weekStr = PoiUtils.getValue(hssfSheet.getRow(2).getCell(22));
		System.out.println(weekStr);
	}

}
